package ejb;

import java.util.ArrayList;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

import repositories.AirportRepository;
import specifications.AirportSpecification;
import entities.Airport;

/**
 * Session Bean implementation class AirportRepositoryBean
 */
@Stateless
@LocalBean
public class AirportRepositoryBean implements AirportRepositoryBeanLocal {

    /**
     * Default constructor. 
     */
    public AirportRepositoryBean() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public ArrayList<Airport> getAllAirports() {
		AirportRepository AR = new AirportRepository();
		AR.FindAll();
		return AR.AirportList;
	}

	@Override
	public ArrayList<Airport> getSpecifiedAirports(
			AirportSpecification airportSpec) {
		AirportRepository AR = new AirportRepository();
		AR.FindAll();
		
		return AR.findBySpecification(airportSpec);
	}

	@Override
	public ArrayList<Airport> getSpecifiedAirports(String cityName) {
		AirportSpecification airportSpec = new AirportSpecification("airportCity",cityName);
		AirportRepository AR = new AirportRepository();
		AR.FindAll();
		return AR.findBySpecification(airportSpec);
	}

}
